<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>js-鼠标点击累加事件</title>
</head>
<body>
    <div id="app">
        <p>点击按钮的次数：<span id="num">0</span></p>
        <button type="button" id="button">点我</button>
    </div>
    <script>
        var mouseClick = 0;
        document.getElementById('button').onclick = function (){
            mouseClick+=1;
            document.getElementById('num').innerHTML=mouseClick;
        }
    </script>
</body>
</html>